'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: category_entity.py
* @Time: 2025/11/10
* @All Rights Reserve By Brtc
'''
from pydantic import BaseModel, field_validator

from internal.exception.exception import FailException


class CategoryEntity(BaseModel):
    """分类信息实体"""
    category:str #分类唯一标识
    name:str # 分类名称
    icon:str # 分类标识

    @field_validator("icon")
    def check_icon_extensions(cls, value:str)->str:
        """校验icon 扩展名称是不是.svg 如果不是抛出异常"""
        if not value.endswith(".svg"):
            raise FailException("该分类的icon 图标不是 svg 格式")
        return value